<template>
  <div>
    <a-form :model="value" :form="form">
      <a-row :gutter="24">
        <a-col :md="{span:12,push:3}" :sm="24">
          <a-form-item
            :labelCol="labelCol"
            :wrapperCol="wrapperCol"
            :hidden="hiding"
            label="赠送积分">
            <a-input-number v-model="value.giftPoint" />
          </a-form-item>
        </a-col>
        <a-col :md="{span:12,push:1}" :sm="24">
          <a-form-item
            :labelCol="labelCol"
            :wrapperCol="wrapperCol"
            :hidden="hiding"
            label="赠送成长值">
            <a-input-number v-model="value.giftGrowth" />
          </a-form-item>
        </a-col>
        <a-col :md="{span:12,push:3}" :sm="24">
          <a-form-item
            :labelCol="labelCol"
            :wrapperCol="wrapperCol"
            :hidden="hiding"
            label="积分购买限制">
            <a-input-number v-model="value.usePointLimit" />
          </a-form-item>
        </a-col>

        <a-col :md="{span:10,push:1}" :sm="24">
          <a-form-item
            :labelCol="labelCol"
            :wrapperCol="wrapperCol"
            :hidden="hiding"
            label="预告商品">
            <j-dict-select-tag v-model="value.previewStatus" placeholder="是否为预告商品：0->不是；1->是" :type="'radio'" @change="handlePreviewStatus" :triggerChange="true" dictCode="yn"/>
          </a-form-item>
        </a-col>
        <!--<a-col :md="{span:6,push:1}" :sm="24">
          <a-form-item
            :labelCol="labelCol"
            :wrapperCol="wrapperCol"
            label="线上销售">
            <j-dict-select-tag v-model="value.publishStatus" placeholder="线上销售状态：0->不是；1->是" :type="'radio'" @change="handlePublishStatus" :disabled="true" dictCode="yn"/>
          </a-form-item>
        </a-col>-->
        <a-col :md="{span:6,push:3}" :sm="24">
          <a-form-item
            :labelCol="labelCol"
            :wrapperCol="wrapperCol"
            label="新品">
            <j-dict-select-tag v-model="value.newStatus" placeholder="新品状态:0->不是新品；1->新品" :type="'radio'" @change="handleNewStatus" :triggerChange="true" dictCode="yn"/>
          </a-form-item>
        </a-col>
        <a-col :md="{span:6,push:3}" :sm="24">
          <a-form-item
            :labelCol="labelCol"
            :wrapperCol="wrapperCol"
            label="推荐">
            <j-dict-select-tag v-model="value.recommandStatus" placeholder="推荐状态；0->不推荐；1->推荐" :type="'radio'" @change="handleRecommandStatus" :triggerChange="true" dictCode="yn"/>
          </a-form-item>
        </a-col>
        <a-col :md="{span:6,push:3}" :sm="24">
          <a-form-item
            :labelCol="labelCol"
            :wrapperCol="wrapperCol"
            label="热门">
            <j-dict-select-tag v-model="value.hotStatus" placeholder="热门状态；0->不热门；1->热门" :type="'radio'" @change="handleHotStatus" :triggerChange="true" dictCode="yn"/>
          </a-form-item>
        </a-col>
        <a-col :md="24" :sm="24">
          <a-form-item
            :labelCol="labelCol"
            :wrapperCol="wrapperCol"
            label="产品标签">
<!--            <j-checkbox v-model="value.serviceIds" :options="this.guaranteeOptions" />-->
            <j-multi-select-tag v-model="value.serviceIds" placeholder="请选择产品标签" :options="value.serviceOptions"/>
          </a-form-item>
        </a-col>
        <a-col :md="24" :sm="24">
          <a-form-item
            :labelCol="labelCol"
            :wrapperCol="wrapperCol"
            label="搜索关键字">
            <a-input placeholder="请输入关键字" v-model="value.keywords" />
          </a-form-item>
        </a-col>
        <a-col :md="24" :sm="24">
          <a-form-item
            :labelCol="labelCol"
            :wrapperCol="wrapperCol"
            label="详情页标题">
            <a-input placeholder="请输入详情标题"  v-model="value.detailTitle"  />
          </a-form-item>
        </a-col>
        <a-col :md="24" :sm="24">
          <a-form-item
            :labelCol="labelCol"
            :wrapperCol="wrapperCol"
            label="详情页描述">
            <a-input placeholder="请输入详情描述" v-model="value.detailDesc"  />
          </a-form-item>
        </a-col>

        <a-col :md="24" :sm="24">
          <a-form-item
            :labelCol="labelCol"
            :wrapperCol="wrapperCol"
            label="备注">
            <a-textarea placeholder="请输入备注" v-model="value.note" :rows="3"/>
          </a-form-item>
        </a-col>
        <a-col :md="24" :sm="24" :style="{ textAlign: 'right' }">
          <a-form-item :wrapperCol="{span: 19, offset: 5}">
            <a-button @click="prevStep">上一步</a-button>
            <a-button style="margin-left: 18px" type="primary" @click="nextStep">下一步</a-button>
          </a-form-item>
        </a-col>
      </a-row>
    </a-form>
  </div>
</template>

<script>
  import JDictSelectTag from '../../../../components/dict/JDictSelectTag.vue'
  import JCheckbox from '../../../../components/jeecg/JCheckbox'
  import JMultiSelectTag from '@/components/dict/JMultiSelectTag'

  export default {
    name: "ProductSaleDetail",
    props: {
      value: Object
    },
    components: {
      JDictSelectTag,
      JCheckbox,
      JMultiSelectTag
    },
    data () {
      return {
        visible: false,
        model: {},
        //1->无忧退货；2->快速退款；3->免费包邮
        guaranteeOptions: [
          { label: '无忧退货', value: 'returngoods' },
          { label: '快速退款', value: 'quickrefund' },
          { label: '免费包邮', value: 'freepost'},
        ],
        labelCol: {
          xs: { span: 24 },
          sm: { span: 6 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        hiding: true,
        confirmLoading: false,
        form: this.$form.createForm(this),
      }
    },
    methods: {
      nextStep () {
        this.$emit('nextStep')
      },
      prevStep () {
        this.$emit('prevStep')
      },
      handlePreviewStatus (e) {
        this.value.previewStatus = e;
      },
      handlePublishStatus (e) {
        this.value.publishStatus = e;
      },
      handleNewStatus (e) {
        this.value.newStatus = e;
      },
      handleRecommandStatus (e) {
        this.value.recommandStatus = e;
      },
      handleHotStatus (e) {
        this.value.hotStatus = e;
      },
      handleChange(value) {
        console.log(`Selected: ${value}`);
      },
      popupScroll() {
        console.log('popupScroll');
      },
    }
  }
</script>

<style lang="less" scoped>

</style>